﻿/****************************************************************
  Author:  Ievgenii Nazaruk, ievgenii.nazaruk@gmail.com 
 License:  Microsoft Public License (Ms-PL)
          ( http://www.opensource.org/licenses/ms-pl.html or
            http://www.microsoft.com/opensource/licenses.mspx )
*****************************************************************/

using WebLayer;
using System;
using System.Net;
using System.Diagnostics;
using System.IO;
using HtmlAgilityPack;
using WebPageParser;
using TableParsers;

class Program
{
    static void Main(string[] args)
    {
        Trace.Listeners.Add(new ConsoleTraceListener());

        LoginToken loginToken = new LoginToken("****", "****", "4001");

        WebPageCache cache = new WebPageCache();
        cache.LoginToken = loginToken;

        ResultsTable table = ResultsTable.Fetch(cache);

        foreach (var a in table)
        {
            Console.WriteLine("{0,5} {1,5}-{2,5} {3,5} {4,5} {5,5} {6,5} {7,5}", a.Course, a.IsLevel?"Level":"Unit", a.UnitOrLevel, 
                    a.Grammar??-1,a.Vocabulary??-1,a.Listening??-1,a.Reading??-1,a.Avarage);
        }
    }
}

